<template>
  <div class="app-container">
    <!--搜索框-->
    <el-form v-model="queryParams" size="small" :inline="true" label-width="68px">
      <el-form-item lable="问卷名称">
        <el-input type="text" v-model="queryParams.surveyName" placeholder="请输入问卷名称"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="getSurveyList">检索</el-button>
      </el-form-item>
    </el-form>

    <!--数据展示-->
    <el-table :data="surveyData" style="width: 100%">
      <el-table-column prop="surveyName" align="center" label="问卷名称" />
      <el-table-column prop="formNum" align="center" label="提交问卷数" />
      <el-table-column prop="formUrl" align="center" label="问卷地址">
        <template slot-scope="scope">
          <div>{{ getEncryptUrl(scope.row.formUrl) }}</div>
        </template>
      </el-table-column>
      <el-table-column prop="isRelease" align="center" label="开启答卷" v-if="user.userId != 12">
        <template slot-scope="scope">
          <el-switch v-model="scope.row.isRelease" :active-value="1" :inactive-value="0"
            @change="handleSound(scope.row)">
          </el-switch>
        </template>
      </el-table-column>
      <el-table-column prop="isSound" align="center" label="录音功能" v-if="user.userId != 12">
        <template slot-scope="scope">
          <el-switch v-model="scope.row.isSound" :active-value="1" :inactive-value="0" @change="handleSound(scope.row)">
          </el-switch>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="400" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button type="text" size="mini" v-if="user.userId != 12" @click="confirmSurvey(scope.row)">
            发布</el-button>

          <el-button type="text" size="mini" v-if="user.userId != 12" @click="handleEidt(scope.row)">
            编辑</el-button>
          <el-button type="text" size="mini" v-if="user.userId != 12" @click="handleFormCopy(scope.row)">
            复制</el-button>
          <el-button type="text" size="mini" v-if="user.userId != 12" @click="getSurveyInfo(scope.row)">预览</el-button>
          <el-button type="text" size="mini"  @click="handleExport(scope.row)">
            导出</el-button>
          <el-button type="text" size="mini" @click="handleFormDataS(scope.row)">
            查看提交数据</el-button>
          <el-button type="text" size="mini" v-if="user.userId != 12" @click="handleFormDataDel(scope.row)">
            删除问卷</el-button>
          <el-button type="text" size="mini" v-if="scope.row.id === 90" @click="downloadOcrFile(scope.row)">
            下载ZIP文件</el-button>
            <el-button type="text" size="mini" v-if="scope.row.id === 90 && user.userId != 12" @click="zipOssFolder(scope.row)">
            生成ZIP包</el-button>
          <el-button type="text" size="mini" v-if="scope.row.id === 94" @click="downloadOcrFile(scope.row)">
            下载OCR文件</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getSurveyList" />
    <!--预览窗口 -->
    <el-dialog title="预览" :visible.sync="dialogVisible" :before-close="handleClose">
      <div class="app-container">
        <div v-if="isSound" v-show="isSound != 0">
          <div style="display: flex; justify-content: center; padding-bottom: 5px">
            <audio v-show="recorderEnd" controls ref="audio" muted="muted" src="" id="audio"></audio>
          </div>
          <div style="display: flex; justify-content: center; padding-bottom: 5px">
            <el-button size="mini" type="primary" @click="startRecoder()">开始录音</el-button>
            <el-button size="mini" type="success" @click="stopRecoder()">结束录音</el-button>
            <el-button size="mini" type="warning" @click="cancelRecoder()">取消录音</el-button>
          </div>
        </div>
        <form-create v-model="fApi" :rule="rule" :option="option" :value.sync="value"></form-create>
      </div>
    </el-dialog>
    <!-- 查看提交数据 -->
    <el-dialog :title="title" width="80%" :visible.sync="formDialogVisible" :before-close="beforeclose">
      <el-form :inline="true" size="mini" v-model="formQueryParams">
        <el-form-item label="采集人姓名">
          <el-input v-model="formQueryParams.name" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="getFormTableList2">搜索</el-button>
          <el-button icon="el-icon-brush" @click="resetForm">重置</el-button>
        </el-form-item>
        <el-form-item style="position: relative; left: 200px;">
          <el-button type="text" size="mini" @click="formDataDelSelect()" v-if="user.userId != 12" >
            删除选中问卷</el-button>
        </el-form-item>
      </el-form>

      <el-table :data="formTable" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55">
        </el-table-column>
        <el-table-column fixed type="index" />

        <el-table-column fixed label="操作" width="100px" align="center" type="index">
          <template slot-scope="scope">
            <el-button type="text" v-if="user.userId != 12"  @click="formDataDel(scope.row)">删除</el-button>
          </template>
        </el-table-column>

        <el-table-column fixed label="预览图片" width="100px" align="center" type="index">
          <template slot-scope="scope">
            <my-image style="width: 30px; height: 30px" :src="localPic" :infinite="false"
              :preview-src-list="viewFormPic(scope.row)" :maskCloseable="true">
            </my-image>
          </template>
        </el-table-column>

        <el-table-column v-for="name in tableTitleJson" :key="name" align="center">
          <template slot="header" slot-scope="scope">
            <span>{{ name }}</span>
          </template>
          <template slot-scope="scope">
            <div v-html="validURL(JSON.parse(scope.row.form)[name])"></div>
            <!--            <el-button type="primary" icon="el-icon-edit" @click="tets">111</el-button>-->
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="formTotal > 0" :total="formTotal" :page.sync="formQueryParams.pageNum"
        :limit.sync="formQueryParams.pageSize" @pagination="getFormTableList" />
    </el-dialog>
    <!-- 导出 -->
    <el-dialog title="导出问卷数据" :visible.sync="exportDialogVisible">
      <el-form ref="exporForm" :model="exporForm">
        <el-form-item label="问卷提交开始日期">
          <el-date-picker type="date" v-model="exporForm.submitDateBeg" value-format="yyyy-MM-dd"
            format="yyyy年MM月dd日" />
        </el-form-item>
        <el-form-item label="问卷提交截至日期">
          <el-date-picker type="date" v-model="exporForm.submitDateEnd" value-format="yyyy-MM-dd"
            format="yyyy年MM月dd日" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleConfirmExport">确认</el-button>
          <el-button @click="exportDialogVisible = false">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <el-dialog title="导出OCR数据" :visible.sync="exportOCRDialogVisible">
      <el-form ref="exporOCRForm" :model="exporOCRForm">
        <el-form-item label="选择导出OCR文件日期">
          <el-date-picker type="date" v-model="exporOCRForm.submitDate" value-format="yyyy-MM-dd"
            format="yyyy年MM月dd日" />
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="handleConfirmExportOCR">确认</el-button>
          <el-button @click="exportOCRDialogVisible = false">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <el-dialog title="重新生成ZIP数据,选择北京时间" :visible.sync="exportZIPDialogVisible">
      <el-form ref="exporOCRForm" :model="exporOCRForm">
        <el-form-item label="选择打包ZIP文件日期">
          <el-date-picker type="date" v-model="exporOCRForm.submitDate" value-format="yyyy-MM-dd"
            format="yyyy年MM月dd日" />
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="handleConfirmExportZIP">确认</el-button>
          <el-button @click="exportZIPDialogVisible = false">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import {
  list,
  surveryInfo,
  confirmRelease,
  confirmSound,
  confirmDel,
  confirmCopy,
  exportBRAiZipPath,
  exportHLOCRExcel,
  zipOssFolder
} from "@/api/survery/form";
import {
  saveSurvery,
  list as formDataLit,
  confirmFormDataDel,
  confirmFormDataDelAll
} from "@/api/survery/data";
import { Notification, MessageBox, Message, Loading } from "element-ui";
import Recorder from "js-audio-recorder";
import axios from "axios";
import service from "@/utils/request";
import uniqueId from "@form-create/utils/lib/unique";
var recorder;
let LoadingS;
import "../../../utils/crypto1/crypto/crypto";
import "../../../utils/crypto1/hmac/hmac";
import "../../../utils/crypto1/sha1/sha1";
import "../../../utils/crypto1/aes/aes";
import { Base64 } from "js-base64";
import MyImage from "../../../components/MyImage/src/main.vue";
import { encrypt, decrypt } from "@/utils/jsencrypt";
import { getToken } from "@/utils/auth";
import { getUserProfile } from "@/api/system/user";

/**
 * 生成policy和签名
 * 默认1小时后失效
 * @param {*} accessKeySecret oss accessKeySecret
 * @param {*} expiration 过期时间 单位秒
 * @returns
 */
function genSignature(fileName) {
  const accessKeySecret = "ZNVPLxgMYGa7CZsghYOVnyOyyJOGFv";
  const expiration = new Date(Date.now() + 1200 * 1000).toISOString();
  const policy = {
    expiration: expiration, // 失效时间
    conditions: [
      ["content-length-range", 0, 469824028], // 设置上传文件的大小限制 1G
    ],
  };
  const policyBase64 = Base64.encode(JSON.stringify(policy));

  const bytes = Crypto.HMAC(Crypto.SHA1, policyBase64, accessKeySecret, {
    asBytes: true,
  });
  const signature = Crypto.util.bytesToBase64(bytes);

  return {
    OSSAccessKeyId: "LTAI5tEewCaBy7zsdcL6GmVT",
    policy: policyBase64,
    key: fileName,
    success_action_status: "200",
    signature,
  };
}

var tableTitleJson;
var date = new Date();
var fileS =
  date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate() + "/";

export default {
  components: { MyImage },
  data() {
    return {
      user: {},
      queryParams: {
        id: undefined,
        surveyName: undefined,
        rule: undefined,
        option: undefined,
        isSound: undefined,
        isRelease: undefined,
        pageNum: 1,
        pageSize: 10,
      },
      total: 0,
      //表单提交数据
      title: "",
      // tableTitleJson: [],
      formTable: [],
      formTotal: 0,
      formQueryParams: {
        id: undefined,
        name: undefined,
        pageNum: 1,
        pageSize: 5,
      },
      formDialogVisible: false,
      exportDialogVisible: false,
      exportOCRDialogVisible: false,
      exportZIPDialogVisible: false,
      exporForm: {
        id: undefined,
        submitDateBeg: undefined,
        submitDateEnd: undefined,
      },
      exporOCRForm: {
        id: undefined,
        submitDate: undefined,
      },
      isReleaseData: [
        { label: "是", value: "1" },
        { label: "否", value: "0" },
      ],
      surveyData: [],
      dialogVisible: false,
      //预览参数
      //实例对象
      fApi: {},
      //表单数据
      value: {},
      //表单生成规则
      rule: [],
      //组件参数配置
      option: {},
      //提交参数
      data: {},
      // coode
      cood: 0,
      isSound: undefined,
      recoderSecond: 0,
      recorderAudio: null,
      talkBtnText: "按住 说话",
      recorderEnd: true,
      localPic: require("@/assets/images/icon-view.png"),
      seletRow: [],
    };
  },
  beforeCreate() {
    getUserProfile().then(response => {
        this.user = response.data;
        // console.log("user", this.user)
      });
  },
  created() {
    // await this.getUser();
    this.getSurveyList();
  },
  methods: {
   
    getEncryptUrl(url) {
      if (url == null || url == undefined) {
        return "";
      }
      let urlArray = url.split("=");
      let encryptId = Crypto.util.bytesToBase64(
        Crypto.util.stringToBytes(
          Crypto.util
            .bytesToWords(Crypto.util.stringToBytes(urlArray[1]))
            .toString()
        )
      );
      return urlArray[0] + "=" + encryptId;
    },
    viewFormPic(e) {
      let viewpic = [];
      var datas;

      const reg =
        /^(http|https):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/;
      Object.values(JSON.parse(e.form)).forEach((data) => {
        if (data != undefined && data.indexOf(",") >= 0) {
          datas = data?.split(",");
          datas?.forEach((data) => {
            if (this.isAssetlypeAn(data)) {
              //     var fileUrls = data?.split("/");
              //     var newFile;
              //       fileUrls?.forEach((data, index) => {
              //      if (index == fileUrls.length - 1) {
              //         newFile = encodeURIComponent(data);
              //      }
              //       });
              //      fileUrls[fileUrls.length - 1] = newFile;
              //       viewpic.push(fileUrls.join("/"));
              viewpic.push(data);
            }
          });
        } else {
          if (this.isAssetlypeAn(data)) {
            viewpic.push(data);
          }
        }
      });
      return viewpic;
    },
    beforeclose() {
      this.tableTitleJson = undefined;
      this.getSurveyList();
      this.formQueryParams.pageNum = 1;
      this.formQueryParams.name = undefined;
      this.formDialogVisible = false;
    },
    validURL(url) {
      var data;
      var datas;

      const reg = /^(https|http):\/\//;
      if (url != undefined && url.indexOf(",") >= 0) {
        datas = url.split(",");
        // console.log("datas", datas);
        for (let i = 0; i <= datas.length; i++) {
          // console.log("匹配成功", i, datas[i]);

          if (reg.test(datas[i])) {
            if (this.isAssetlypeAn(datas[i])) {
              var html = "";
              for (let i = 0; i < datas.length; i++) {
                var newFileUrl = datas[i];
                html += `<button style="border:none" >
                     <img src=${newFileUrl} @click=${newFileUrl} alt="" style="width: 45px;height: 45px;padding-right: 2px">
                     </button>`;
              }
              return html;
            } else {
              var html = "";
              for (let i = 0; i < datas.length; i++) {
                html += `<button style="border:none" onclick="window.open('${datas[i]}')">查看 </button>`;
              }
              return html;
            }
          } else {
            return url;
          }
        }
      } else {
        if (reg.test(url)) {
          console.log("url", url);
          if (this.isAssetlypeAn(url))
            return `<button style="border:none" >
                  <img src=${url} @click=${url} alt="" style="width: 45px;height: 45px;padding-right: 2px">
                  </button>`;
          else
            return `<a style="border:none" onclick="window.open('${url}')">查看</a>`;
        } else {
          return url;
        }
      }
    },
    isAssetlypeAn(ext) {
      if (
        ext.toLowerCase().indexOf(".png") > -1 ||
        ext.toLowerCase().indexOf(".jpg") > -1 ||
        ext.toLowerCase().indexOf(".jpeg") > -1
      )
        return true;
      else return false;
    },

    getSurveyList() {
      list(this.queryParams).then((res) => {
        this.total = res.total;
        this.surveyData = res.rows;
      });
    },
    handleSelectionChange(val) {
      this.seletRow = val
      console.log(this.seletRow); // 在这里你可以处理选择变化的事件，val 是当前选中的行数据数组
    },
    getSurveyInfo(e) {
      surveryInfo(e.id).then((res) => {
        debugger;
        this.data.surverId = e.id;
        var id = e.id;
        this.isSound = res.data.isSound;
        //处理规则中类型为上传的控件信息
        var rule = res.data.rtformRules;
        console.log(rule);
        for (var i = 0; i < res.data.rtformRules.length; i++) {
          if (rule[i].type == "upload") {
            //const filename2 = new Date().getTime()+"_"+i;
            var filename2 = "";
            var randomNum = Math.floor(Math.random() * (99999 - 55 + 1)) + 55;
            console.log("111", randomNum);
            var fileList = [];
            var title = rule[i].title;
            rule[i].props.fileList = fileList;
            (rule[i].props.httpRequest = function (file) {
              const params = new FormData();
              var fileName = id + "/" + fileS + randomNum + file.file.name;
              const data = genSignature(fileName);
              params.append("OSSAccessKeyId", data.OSSAccessKeyId);
              params.append("key", fileName);
              params.append(
                "success_action_status",
                data.success_action_status
              );
              params.append("signature", data.signature);
              params.append("policy", data.policy);
              params.append("file", file.file);
              const config = {
                headers: {
                  Accept: "*/*",
                  "Content-Type": "multipart/form-data",
                },
              };
              axios.post(file.action, params, config).then((res) => {
                file.onSuccess(res);
                const data = {
                  name: file.file.name,
                  url: "http://img.cscxsk.cn/" + fileName,
                };
                file.response = data;
                fileList.push(file);
              });
            }),
              (rule[i].props.onSuccess = function (res, file, fileList) {
                file.url =
                  "http://img.cscxsk.cn/" + id + "/" + fileS + file.name;
                console.log(file.url);
                Message({ message: title + "上传成功!", type: "success" });
                LoadingS.close();
              });
            rule[i].props.beforeUpload = function (file) {
              LoadingS = Loading.service({
                text: "正在上传，请稍候",
                spinner: "el-icon-loading",
                background: "rgba(0, 0, 0, 0.7)",
              });
            };
            rule[i].props.onError = function (file) {
              Message({ message: title + "上传失败!", type: "error" });
              LoadingS.close();
            };
          }
        }

        this.rule = rule;
        //处理form表单 默认提交按钮
        this.option = res.data.rtformOption;

        this.option.onSubmit = function (formData) {
          if (recorder) {
            var blob = recorder.getWAVBlob();
            var formDataq = new FormData();
            // 此处获取到blob对象后需要设置fileName满足当前项目上传需求，其它项目可直接传把blob作为file塞入formData
            const newbolb = new Blob([blob], { type: "audio/wav" });
            //获取当时时间戳作为文件名
            const fileOfBlob = new File(
              [newbolb],
              new Date().getTime() + ".wav"
            );
            formDataq.append("file", fileOfBlob);
            axios
              .post(
                process.env.VUE_APP_BASE_API + "/common/AliUpload",
                formDataq
              )
              .then((res) => {
                console.log(res.data);
                formData["录音地址"] = res.data.url;
                for (var key in formData) {
                  if (typeof formData[key] == "object") {
                    formData[key] = formData[key].join(",");
                  }
                }
                const data = { surverId: e.id, form: JSON.stringify(formData) };
                saveSurvery(data).then((res) => {
                  alert("提交成功！");
                });
              });
          } else {
            for (var key in formData) {
              if (typeof formData[key] == "object") {
                formData[key] = formData[key].join(",");
              }
            }
            const data = { surverId: e.id, form: JSON.stringify(formData) };
            saveSurvery(data).then((res) => {
              alert("提交成功！");
              location.reload();
            });
          }
        };
        this.dialogVisible = true;
      });
    },
    startRecoder() {
      recorder = new Recorder();
      this.recorderAudio = document.querySelector("#audio");
      recorder.start();
    },
    stopRecoder() {
      if (!recorder) {
        return;
      }
      var blob = recorder.getWAVBlob();
      document.querySelector("#audio").src = URL.createObjectURL(blob);
      document.querySelector("#audio").controls = true;
      // var formDataq = new FormData()
      // // 此处获取到blob对象后需要设置fileName满足当前项目上传需求，其它项目可直接传把blob作为file塞入formData
      // const newbolb = new Blob([blob], { type: 'audio/wav' })
      // //获取当时时间戳作为文件名
      // const fileOfBlob = new File([newbolb], new Date().getTime() + '.wav')
      // formDataq.append('file', fileOfBlob)
      // axios.post(process.env.VUE_APP_BASE_API+"/common/AliUpload",formDataq)
    },
    cancelRecoder() {
      this.recoderSecond = 0;
      if (!recorder) {
        return;
      }
      recorder.destroy();
      document.querySelector("#audio").src = "";
      recorder = null;
    },
    handleClose() {
      this.dialogVisible = false;
    },
    /** 导出按钮操作 */
    handleExport(e) {
      this.exporForm.id = e.id;
      this.exportDialogVisible = true;
    },
    downloadOcrFile(e) {
      this.exporForm.id = e.id;
      this.exportOCRDialogVisible = true;
    }, 
    zipOssFolder(e) {
      this.exporForm.id = e.id;
      this.exportZIPDialogVisible = true;
    },
    handleConfirmExport() {
      this.exportDialogVisible = false;
      this.download(
        "survery/exportss",
        this.exporForm,
        `${new Date().getTime()}.xlsx`
      );
    },
    handleConfirmExportZIP() {
      this.exportZIPDialogVisible = false;
         zipOssFolder({ data: this.exporOCRForm.submitDate }).then((res) => {
          console.log("res", res)
          if (res.code === 200) {
              alert("开始压缩，请在宝塔查看进度！");
          }
        });
    },
    handleConfirmExportOCR() {
      this.exportOCRDialogVisible = false;
      //如果是海外的项目
      if (this.exporForm.id == 90) {
        // this.download(
        //   "survery/exportUberAiZip",
        //   { submitDate: this.exporOCRForm.submitDate },
        //   `${new Date().getTime()}.zip`
        // );
        exportBRAiZipPath({ submitDate: this.exporOCRForm.submitDate }).then((res) => {
          console.log("res", res)
          if (res.code === 200) {
            this.downloadFile(res.data)
          }
        });
      } else if (this.exporForm.id == 94) {  //如果是哈罗的项目
        exportHLOCRExcel({ submitDate: this.exporOCRForm.submitDate }).then((res) => {
          console.log("res", res)
          if (res.code === 200) {
            this.downloadFile(res.data)
          }
        });
      }

    },

    downloadFile(url) {
      var downloadLink = document.createElement('a');
      downloadLink.href = url;
      downloadLink.target = "_blank";
      downloadLink.click();
    },
    /**编辑**/
    handleEidt(e) {
      this.$router.push({ name: "Survey", params: { id: e.id } });
    },
    /**复制**/
    handleFormCopy(e) {
      this.$modal
        .confirm("是否复制名称：“" + e.surveyName + "”的问卷？并且新建问卷！")
        .then(() => {
          confirmCopy(e).then((res) => {
            this.getSurveyList();
          });
        });
    },
    /**查看提交数据**/
    getFormTableList() {
      formDataLit(this.formQueryParams).then((res) => {
        this.formTable = res.rows;
        this.formTotal = res.total;
        if (this.tableTitleJson == undefined)
          this.tableTitleJson = Object.keys(JSON.parse(res.rows[0].form));
      });
    },
    getFormTableList2() {
      this.formQueryParams.pageNum = 1;
      formDataLit(this.formQueryParams).then((res) => {
        this.formTable = res.rows;
        this.formTotal = res.total;
        if (this.tableTitleJson == undefined)
          this.tableTitleJson = Object.keys(JSON.parse(res.rows[0].form));
      });
    },
    resetForm() {
      this.formQueryParams.pageNum = 1;
      this.formQueryParams.name = undefined;
      this.getFormTableList();
    },
    handleFormDataS(e) {
      this.title = e.surveyName;
      this.formQueryParams.id = e.id;
      this.formDialogVisible = true;
      this.getFormTableList();
    },
    /**
     * 删除答卷
     */
    handleFormDataDel(e) {
      this.$modal
        .confirm(
          '是否删除名称为"' + e.surveyName + '"的问卷？并且删除已提交的数据'
        )
        .then(() => {
          confirmDel(e).then((res) => {
            this.getSurveyList();
          });
        })
        .catch(() => { });
    },
    formDataDel(e) {
      this.$modal
        .confirm("是否删除该条提交的数据")
        .then(() => {
          confirmFormDataDel(e).then((res) => {
            this.getFormTableList();
          });
        })
        .catch(() => { });
    },
    formDataDelSelect() {
      this.$modal
        .confirm("是否删除选中的数据")
        .then(() => {
          confirmFormDataDelAll(this.seletRow).then(res => {
            this.getFormTableList();
          })
        })
        .catch(() => { });
    },
    /**
     * 开启录音功能
     */
    handleSound(e) {
      confirmSound(e);
    },
    /**发布*/
    confirmSurvey(e) {
      var url = window.location.origin;
      var data = Object.assign({}, e);
      data.formUrl = url;
      this.$modal
        .confirm('是否确认发布名称为"' + e.surveyName + '"的问卷？')
        .then(() => {
          confirmRelease(data).then((res) => {
            this.getSurveyList();
          });
        })
        .catch(() => { });
    },

  },
};
</script>

<style scoped></style>
